package com.lucifer.cloud.boot.blog.chat.config;

import com.lark.oapi.Client;
import com.lark.oapi.core.enums.BaseUrlEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
@RequiredArgsConstructor
public class FeishuClientConfig {

    private final FeishuConfig feishuConfig;

    @Bean
    public Client getClient() {
        return Client.newBuilder(feishuConfig.getAppId(), feishuConfig.getAppSecret())
            .marketplaceApp()
            .openBaseUrl(BaseUrlEnum.FeiShu)
            .requestTimeout(3, TimeUnit.SECONDS)
            .logReqAtDebug(true)
            .build();
    }


}
